<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
  <th:block th:include="include :: header('新增工单模板')"/>
  <!--<th:block th:include="include :: select2-css" />-->
  <link th:href="@{/ajax/libs/bootstrap-tagsinput/tagsinput.css}" rel="stylesheet">
  <link th:href="@{/ajax/libs/jQuery-ui/jquery-ui.css}" rel="stylesheet">
  <link rel="stylesheet" type="text/css" th:href="@{/ajax/libs/qxEasyUI/themes/default/easyui.css}">

</head>
<style>
  .bootstrap-tagsinput > input {
    display: none;
  }
</style>

<body style="background-color: #F4F6FA">
<div class="main-content" style="margin: 0;padding: 0">

  <form id="form-user-add" class="form-horizontal" style="background-color: #F4F6FA">
<!--    <input type="hidden" name="attachPath"/>-->

    <div class="col-sm-12" style="display: flex;justify-content: center">
      <div class="col-sm-10 entering-page">
        <!--系统公告-->
        <div class="col-sm-12">
          <div class="col-sm-12" style="display: flex;justify-content: space-between">
            <div class="tltieBoder">
              <div class="blueBorder"></div>
              <h4 style="margin:0 0 0 10px">工单模板</h4>
            </div>
          </div>
          <!--模板名称-->
          <div class="form-group col-sm-12">
            <label class="col-sm-3 control-label entering-pd">模板名称：</label>
            <div class="col-sm-5">
              <input name="sortModelName" id="sortModelName" placeholder="请输入模板名称" class="form-control" type="text"
                     required="required">
            </div>
          </div>
          <!--内容类别-->
<!--          <div class="form-group col-sm-12">-->
<!--            <label class="col-sm-3 control-label entering-pd">内容类别：</label>-->
<!--            <div class="col-sm-9">-->
<!--              <input id="qxCT" style="width:242px;height:31px;"/>-->
<!--              <input type="hidden" name="codePk" id="codePk"/>-->
<!--            </div>-->
<!--          </div>-->
          <!--模板内容-->
          <div class="form-group col-sm-12">
            <label class="col-sm-3 control-label entering-pd">模板内容：</label>
            <div class="col-sm-9">
              <textarea name="sortModel" rows="10" style="width: 540px"></textarea>
            </div>
          </div>
        </div>
        <!--按钮-->
        <div class="col-sm-12 entering-bt" style="justify-content: center;margin-top: 10px">
          <button type="button" class="btn btn-sm btn-info" onclick="doSubmit()">新增
          </button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <button type="button" class="btn btn-sm btn-warning" onclick="closeItem()">关闭
          </button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

        </div>
      </div>
    </div>
</div>

</form>
</div>

<th:block th:include="include :: footer"/>
<script th:src="@{/ajax/libs/qxEasyUI/jquery.easyui.min.js}"></script>

<script>
  var prefix = "/system/mTelRcd/cmnFile";

  function doSubmit(){
    var sortModelName = $('#sortModelName').val();
    $.ajax({
      url : prefix + '/validateSMName',
      data: {oldName:'',newName:sortModelName,act:'add'},
      dataType : 'json',
      type : 'POST',
      success : function(data) {
          if (data == true) {
            var url = prefix + '/tSortModelAdd';
            var data = $('#form-user-add').serializeArray();
            $.operate.saveTab(url,data);
          }else {
            $.modal.msgWarning("模板名称重复!")
          }
      }
    })
  }

  $('#qxCT').combotree({
    url: '/system/common/findContentCate',
    required: false,
    onSelect: function (record) {
      $("#codePk").val(record.id);
    }
  });
</script>
</body>
</html>

